package cn.edu.sgu.www.mhxysy.controller.fabao;

import cn.edu.sgu.www.mhxysy.consts.CustomConstants;
import cn.edu.sgu.www.mhxysy.consts.CustomMessages;
import cn.edu.sgu.www.mhxysy.consts.MimeTypes;
import cn.edu.sgu.www.mhxysy.restful.JsonResult;
import cn.edu.sgu.www.mhxysy.service.fabao.FabaoSixiangAttributeService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;
import java.util.Map;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Api(tags = "法宝四象属性管理")
@ApiSupport(author = CustomConstants.AUTHOR)
@Validated
@RestController
@RequestMapping(path = "/fabao_sixiang_attribute", produces = MimeTypes.APPLICATION_JSON_CHARSET_UTF_8)
public class FabaoSixiangAttributeController {

	private final FabaoSixiangAttributeService sixiangAttributeService;

	@Autowired
	public FabaoSixiangAttributeController(FabaoSixiangAttributeService sixiangAttributeService) {
		this.sixiangAttributeService = sixiangAttributeService;
	}

	@ApiOperation("查询法宝的四象属性")
	@RequestMapping(value = "/selectByFabaoId", method= RequestMethod.GET)
	public JsonResult<Map<String, String>> selectByFabaoId(
			@ApiParam(name = "fabaoId", value = "法宝ID", required = true)
			@NotBlank(message = CustomMessages.FABAO_ID_NOT_NULL) String fabaoId) {
		Map<String, String> stringMap = sixiangAttributeService.selectByFabaoId(fabaoId);

		return JsonResult.success(null, stringMap);
	}

}